#pragma once

// Game Engine
// Created by Ruben Rigole


#include "AbstractGame.h"

// Voor logger
#include "Logger.h"

#define GAME_ENGINE GameEngine::GetSingleton()
#define LOG(x) {Logger::GetSingleton()->Log(x);}

// Windows Callback
LRESULT CALLBACK	WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

class GameEngine
{
public:
	static GameEngine* GetSingleton();

	virtual ~GameEngine();

	void SetGame(AbstractGame* gamePtr);
	bool Run(HINSTANCE hInstance, int iCmdShow);

	int GetWidth() const;
	int GetHeight() const;

	HWND GetWindow() const;
	HINSTANCE GetInstance() const;
	AbstractGame* GetGame() const;

	LRESULT HandleEvent(HWND hWindow, UINT msg, WPARAM wParam, LPARAM lParam);

private:
	GameEngine();
	HRESULT CreateNewWindow(int cmdShow);

	static GameEngine* m_GameEnginePtr;
	bool m_AppPaused;
	int m_Width, m_Height;
	DWORD m_OldTime;
	
	AbstractGame* m_GamePtr;
	HWND m_hWindow;

	HINSTANCE m_hInstance;


	GameEngine(const GameEngine &t);
	GameEngine& operator= (const GameEngine &t);
};